<?php

/**
 * This is the model class for table "tbl_rec".
 *
 * The followings are the available columns in table 'tbl_rec':
 * @property string $custno
 * @property string $invoice
 * @property string $invdate
 * @property string $invamt
 * @property string $dept
 * @property string $locno
 * @property string $jobnumber
 * @property string $agrmtno
 * @property string $paid
 * @property string $type
 * @property string $notes
 * @property string $acct
 * @property string $latecredit
 * @property string $period
 * @property string $paidoff
 * @property string $lastpaid
 * @property string $post
 * @property string $prepaykey
 * @property string $transid
 */
class Rec extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Rec the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'tbl_rec';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('custno, invoice, invamt, dept, locno, jobnumber, agrmtno, paid, type, notes, acct, latecredit, period, post, prepaykey, transid', 'safe'),
			array('custno, agrmtno', 'length', 'max'=>7),
			array('invoice, paid, acct', 'length', 'max'=>10),             
			array('dept', 'length', 'max'=>2),
			array('locno', 'length', 'max'=>5),
			array('jobnumber', 'length', 'max'=>41),
			array('type, post', 'length', 'max'=>1),
			array('latecredit, prepaykey', 'length', 'max'=>20),
			array('period', 'length', 'max'=>6),
			array('transid', 'length', 'max'=>36),
			array('invdate, paidoff, lastpaid', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('custno, invoice, invdate, invamt, dept, locno, jobnumber, agrmtno, paid, type, notes, acct, latecredit, period, paidoff, lastpaid, post, prepaykey, transid', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
                    'invoiceModel'=>array(self::BELONGS_TO,'Invoice','invoice'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'custno' => 'Custno',
			'invoice' => 'Invoice',
			'invdate' => 'Invdate',
			'invamt' => 'Invamt',
			'dept' => 'Dept',
			'locno' => 'Locno',
			'jobnumber' => 'Jobnumber',
			'agrmtno' => 'Agrmtno',
			'paid' => 'Paid',
			'type' => 'Type',
			'notes' => 'Notes',
			'acct' => 'Acct',
			'latecredit' => 'Latecredit',
			'period' => 'Period',
			'paidoff' => 'Paidoff',
			'lastpaid' => 'Lastpaid',
			'post' => 'Post',
			'prepaykey' => 'Prepaykey',
			'transid' => 'Transid',
		);
	}
        //public function 
}